package com.gitee.wsl.time.chinese.util

import kotlin.jvm.JvmOverloads


/**
 * 道历节日
 *
 * @author 6tail
 */
class TaoFestival @JvmOverloads constructor(
    /**
     * 名称
     */
    val name: String,
    /**
     * 备注
     */
    val remark: String = "",
) {

    override fun toString(): String {
        return name
    }

    fun toFullString(): String {
        val s = StringBuilder()
        s.append(name)
        if (remark.isNotEmpty()) {
            s.append("[")
            s.append(remark)
            s.append("]")
        }
        return s.toString()
    }
}


/**
 * 道历工具
 *
 * @author 6tail
 */
object TaoUtil {
    /**
     * 日期对应的节日
     */
    val FESTIVAL: Map<String, List<TaoFestival>> = mutableMapOf<String, List<TaoFestival>>().apply{
            put("1-1", listOf(TaoFestival("天腊之辰", "天腊，此日五帝会于东方九炁青天")))
            put("1-3", listOf(TaoFestival("郝真人圣诞"), TaoFestival("孙真人圣诞")))
            put("1-5", listOf(TaoFestival("孙祖清静元君诞")))
            put("1-7", listOf(TaoFestival("举迁赏会", "此日上元赐福，天官同地水二官考校罪福")))
            put("1-9", listOf(TaoFestival("玉皇上帝圣诞")))
            put("1-13", listOf(TaoFestival("关圣帝君飞升")))
            put("1-15", listOf(TaoFestival("上元天官圣诞"), TaoFestival("老祖天师圣诞")))
            put("1-19", listOf(TaoFestival("长春邱真人(邱处机)圣诞")))
            put("1-28", listOf(TaoFestival("许真君(许逊天师)圣诞")))
            put("2-1", listOf(TaoFestival("勾陈天皇大帝圣诞"), TaoFestival("长春刘真人(刘渊然)圣诞")))
            put("2-2", listOf(TaoFestival("土地正神诞"), TaoFestival("姜太公圣诞")))
            put("2-3", listOf(TaoFestival("文昌梓潼帝君圣诞")))
            put("2-6", listOf(TaoFestival("东华帝君圣诞")))
            put("2-13", listOf(TaoFestival("度人无量葛真君圣诞")))
            put("2-15", listOf(TaoFestival("太清道德天尊(太上老君)圣诞")))
            put("2-19", listOf(TaoFestival("慈航真人圣诞")))
            put("3-1", listOf(TaoFestival("谭祖(谭处端)长真真人圣诞")))
            put("3-3", listOf(TaoFestival("玄天上帝圣诞")))
            put("3-6", listOf(TaoFestival("眼光娘娘圣诞")))
            put("3-15", listOf(TaoFestival("天师张大真人圣诞"), TaoFestival("财神赵公元帅圣诞")))
            put("3-16", listOf(TaoFestival("三茅真君得道之辰"), TaoFestival("中岳大帝圣诞")))
            put("3-18", listOf(TaoFestival("王祖(王处一)玉阳真人圣诞"), TaoFestival("后土娘娘圣诞")))
            put("3-19", listOf(TaoFestival("太阳星君圣诞")))
            put("3-20", listOf(TaoFestival("子孙娘娘圣诞")))
            put("3-23", listOf(TaoFestival("天后妈祖圣诞")))
            put("3-26", listOf(TaoFestival("鬼谷先师诞")))
            put("3-28", listOf(TaoFestival("东岳大帝圣诞")))
            put("4-1", listOf(TaoFestival("长生谭真君成道之辰")))
            put("4-10", listOf(TaoFestival("何仙姑圣诞")))
            put("4-14", listOf(TaoFestival("吕祖纯阳祖师圣诞")))
            put("4-15", listOf(TaoFestival("钟离祖师圣诞")))
            put(
                "4-18",
                listOf(
                    TaoFestival("北极紫微大帝圣诞"),
                    TaoFestival("泰山圣母碧霞元君诞"),
                    TaoFestival("华佗神医先师诞")
                )
            )
            put("4-20", listOf(TaoFestival("眼光圣母娘娘诞")))
            put("4-28", listOf(TaoFestival("神农先帝诞")))
            put("5-1", listOf(TaoFestival("南极长生大帝圣诞")))
            put(
                "5-5",
                listOf(
                    TaoFestival("地腊之辰", "地腊，此日五帝会于南方三炁丹天"),
                    TaoFestival("南方雷祖圣诞"),
                    TaoFestival("地祗温元帅圣诞"),
                    TaoFestival("雷霆邓天君圣诞")
                )
            )
            put("5-11", listOf(TaoFestival("城隍爷圣诞")))
            put("5-13", listOf(TaoFestival("关圣帝君降神"), TaoFestival("关平太子圣诞")))
            put("5-18", listOf(TaoFestival("张天师圣诞")))
            put("5-20", listOf(TaoFestival("马祖丹阳真人圣诞")))
            put("5-29", listOf(TaoFestival("紫青白祖师圣诞")))
            put("6-1", listOf(TaoFestival("南斗星君下降")))
            put("6-2", listOf(TaoFestival("南斗星君下降")))
            put("6-3", listOf(TaoFestival("南斗星君下降")))
            put("6-4", listOf(TaoFestival("南斗星君下降")))
            put("6-5", listOf(TaoFestival("南斗星君下降")))
            put("6-6", listOf(TaoFestival("南斗星君下降")))
            put("6-10", listOf(TaoFestival("刘海蟾祖师圣诞")))
            put("6-15", listOf(TaoFestival("灵官王天君圣诞")))
            put("6-19", listOf(TaoFestival("慈航(观音)成道日")))
            put("6-23", listOf(TaoFestival("火神圣诞")))
            put("6-24", listOf(TaoFestival("南极大帝中方雷祖圣诞"), TaoFestival("关圣帝君圣诞")))
            put("6-26", listOf(TaoFestival("二郎真君圣诞")))
            put(
                "7-7",
                listOf(
                    TaoFestival("道德腊之辰", "道德腊，此日五帝会于西方七炁素天"),
                    TaoFestival("庆生中会", "此日中元赦罪，地官同天水二官考校罪福")
                )
            )
            put("7-12", listOf(TaoFestival("西方雷祖圣诞")))
            put("7-15", listOf(TaoFestival("中元地官大帝圣诞")))
            put("7-18", listOf(TaoFestival("王母娘娘圣诞")))
            put("7-20", listOf(TaoFestival("刘祖(刘处玄)长生真人圣诞")))
            put("7-22", listOf(TaoFestival("财帛星君文财神增福相公李诡祖圣诞")))
            put("7-26", listOf(TaoFestival("张三丰祖师圣诞")))
            put("8-1", listOf(TaoFestival("许真君飞升日")))
            put("8-3", listOf(TaoFestival("九天司命灶君诞")))
            put("8-5", listOf(TaoFestival("北方雷祖圣诞")))
            put("8-10", listOf(TaoFestival("北岳大帝诞辰")))
            put("8-15", listOf(TaoFestival("太阴星君诞")))
            put("9-1", listOf(TaoFestival("北斗九皇降世之辰")))
            put("9-2", listOf(TaoFestival("北斗九皇降世之辰")))
            put("9-3", listOf(TaoFestival("北斗九皇降世之辰")))
            put("9-4", listOf(TaoFestival("北斗九皇降世之辰")))
            put("9-5", listOf(TaoFestival("北斗九皇降世之辰")))
            put("9-6", listOf(TaoFestival("北斗九皇降世之辰")))
            put("9-7", listOf(TaoFestival("北斗九皇降世之辰")))
            put("9-8", listOf(TaoFestival("北斗九皇降世之辰")))
            put(
                "9-9",
                listOf(
                    TaoFestival("北斗九皇降世之辰"),
                    TaoFestival("斗姥元君圣诞"),
                    TaoFestival("重阳帝君圣诞"),
                    TaoFestival("玄天上帝飞升"),
                    TaoFestival("酆都大帝圣诞")
                )
            )
            put("9-22", listOf(TaoFestival("增福财神诞")))
            put("9-23", listOf(TaoFestival("萨翁真君圣诞")))
            put("9-28", listOf(TaoFestival("五显灵官马元帅圣诞")))
            put(
                "10-1",
                listOf(TaoFestival("民岁腊之辰", "民岁腊，此日五帝会于北方五炁黑天"), TaoFestival("东皇大帝圣诞"))
            )
            put("10-3", listOf(TaoFestival("三茅应化真君圣诞")))
            put("10-6", listOf(TaoFestival("天曹诸司五岳五帝圣诞")))
            put(
                "10-15",
                listOf(TaoFestival("下元水官大帝圣诞"), TaoFestival("建生大会", "此日下元解厄，水官同天地二官考校罪福"))
            )
            put("10-18", listOf(TaoFestival("地母娘娘圣诞")))
            put("10-19", listOf(TaoFestival("长春邱真君飞升")))
            put("10-20", listOf(TaoFestival("虚靖天师(即三十代天师弘悟张真人)诞")))
            put("11-6", listOf(TaoFestival("西岳大帝圣诞")))
            put("11-9", listOf(TaoFestival("湘子韩祖圣诞")))
            put("11-11", listOf(TaoFestival("太乙救苦天尊圣诞")))
            put("11-26", listOf(TaoFestival("北方五道圣诞")))
            put("12-8", listOf(TaoFestival("王侯腊之辰", "王侯腊，此日五帝会于上方玄都玉京")))
            put("12-16", listOf(TaoFestival("南岳大帝圣诞"), TaoFestival("福德正神诞")))
            put("12-20", listOf(TaoFestival("鲁班先师圣诞")))
            put("12-21", listOf(TaoFestival("天猷上帝圣诞")))
            put("12-22", listOf(TaoFestival("重阳祖师圣诞")))
            put("12-23", listOf(TaoFestival("祭灶王", "最适宜谢旧年太岁，开启拜新年太岁")))
            put("12-25", listOf(TaoFestival("玉帝巡天"), TaoFestival("天神下降")))
            put("12-29", listOf(TaoFestival("清静孙真君(孙不二)成道")))
    }

    /**
     * 八会日
     */
    val BA_HUI: Map<String, String> = mutableMapOf<String, String>().apply{
            put("丙午", "天会")
            put("壬午", "地会")
            put("壬子", "人会")
            put("庚午", "日会")
            put("庚申", "月会")
            put("辛酉", "星辰会")
            put("甲辰", "五行会")
            put("甲戌", "四时会")
    }

    /**
     * 八节日
     */
    val BA_JIE: Map<String, String> = mutableMapOf<String, String>().apply{
            put("立春", "东北方度仙上圣天尊同梵炁始青天君下降")
            put("春分", "东方玉宝星上天尊同青帝九炁天君下降")
            put("立夏", "东南方好生度命天尊同梵炁始丹天君下降")
            put("夏至", "南方玄真万福天尊同赤帝三炁天君下降")
            put("立秋", "西南方太灵虚皇天尊同梵炁始素天君下降")
            put("秋分", "西方太妙至极天尊同白帝七炁天君下降")
            put("立冬", "西北方无量太华天尊同梵炁始玄天君下降")
            put("冬至", "北方玄上玉宸天尊同黑帝五炁天君下降")
    }

    /**
     * 三会日
     */
    val SAN_HUI: Array<String> = arrayOf<String>("1-7", "7-7", "10-15")

    /**
     * 三元日
     */
    val SAN_YUAN: Array<String> = arrayOf<String>("1-15", "7-15", "10-15")

    /**
     * 五腊日
     */
    val WU_LA: Array<String> = arrayOf<String>("1-1", "5-5", "7-7", "10-1", "12-8")

    /**
     * 暗戊
     */
    val AN_WU: Array<String> = arrayOf<String>("未", "戌", "辰", "寅", "午", "子", "酉", "申", "巳", "亥", "卯", "丑")
}
